package com.zzty.train.controller;

import com.zzty.train.entity.User;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

@RestController
@RequestMapping("/session")
public class SessionController {
    private static final Logger logger = LoggerFactory.getLogger(SessionController.class);


    @RequestMapping("/getUser")
    public Map getOpenId(HttpServletRequest request){
        User user =(User)request.getSession().getAttribute("user");
        logger.info("----------user is : "+user.toString());
        Map<String,Object> map=new HashMap<>();
        map.put("user",user);
        return map;
    }
}

